package cn.hyh.core.config;

import com.baomidou.mybatisplus.extension.plugins.PaginationInterceptor;
import com.baomidou.mybatisplus.extension.plugins.PerformanceInterceptor;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Profile;

/**
 * @auther :hyh
 * @desc :
 * @date :2019/7/14
 */
@Configuration
public class MybatisPlusConfig {

    //配置物理分页插件
    @Bean
    public PaginationInterceptor   paginationInterceptor() {
        PaginationInterceptor interceptor = new PaginationInterceptor();
        interceptor.setDialectType("mysql");
        return interceptor;
    }

   //性能分析PerformanceInterceptor

    @Bean
    @Profile({"test","dev"})   //只在test/dev 环境下起作用。
    public PerformanceInterceptor  performanceInterceptor() {
        return new PerformanceInterceptor();
    }
}
